﻿define([
    'Wjs/data/Loader'
],
function () {
    'use strict';

    var Loader = Wjs.getType('Loader');

    return Wjs.defineOnce({

        type: 'LocalLoader',

        internal: {

            base: Loader,

            initialize: function () {

                this.setContentType('json');
            }
        },

        setData: function (data) {

            this.data = data;

            return this;
        },

        getData: function (callback) {
            var data = Wjs.isFunction(this.data) ? this.data.call(this.scope) : this.data;

            this.handleDataEvents(data, callback);
        },

        clone: function () {
            var cloned = Loader.prototype.clone.call(this);

            cloned.data = this.data;

            return cloned;
        }

    });
});